package com.dingding.aop;

import com.dingding.common.TokenException;
import com.dingding.entity.BaseResponse;
import com.dingding.enums.ResponseCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class SecurityExceptionHandler {

    @ExceptionHandler(value = {TokenException.class})
    public BaseResponse tokenException(TokenException e) {
        return new BaseResponse(ResponseCode.getResponseByCode(e.getCode()), "token exception");
    }
}
